package net.litxuf.Util;

import org.apache.log4j.Logger;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.IOException;

/**
 * Created by IntelliJ IDEA.
 * User: hmb
 * Date: 2007-7-6
 * Time: 12:22:01
 * To change this template use File | Settings | File Templates.
 */
public class LoggerHelper
{
    public static void error(Logger logger,String text)
    {
        logger.error(text);
    }
    public static void error(Logger logger,Exception e)
    {
        StringWriter errorInfo=new StringWriter();
        PrintWriter pw=new PrintWriter(errorInfo);
        e.printStackTrace(pw);
        logger.error(errorInfo);
        pw.close();
        try {
            errorInfo.close();
        } catch (IOException e1) {
            e1.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
    }
}
